/**
 *
 */
package cre.gutwo.convert;

import cre.gutwo.domain.CompanyCode;
import cre.gutwo.domain.DataModel;
import cre.gutwo.domain.DeviceInfo;
import cre.gutwo.util.Constants;

/**
 * @author Cre.Gu
 */
public class HwConverter extends DefaultConverter {

    @Override
    protected void putDestHeaders(DataModel re) {
        re.putAll(gainHwDestHeaders());
    }

    @Override
    protected void specConvert(DataModel dm, DataModel re) {
        // 注意先后
        String[] specsd = {Constants.LINKAGE_ID, Constants.DEVICE_ID, Constants.MACADDR, Constants.IPADDR,
                Constants.OS, Constants.OS_LEVEL};
        String[] specsc = {Constants.COMPANYID};

        DeviceInfo di = gainDeviceInfo(dm);
        if (di != null) {

            for (String spec : specsd) {
                changeValDi(re, di, spec);
            }
        } else {
            // 记录deviceInfo为null
            re.setDeviceInfoFound(false);
        }

        CompanyCode cc = gainCompanyCode(re);
        if (cc != null) {

            for (String spec : specsc) {
                changeValCc(re, cc, spec);
            }
        }
    }

}
